﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace vfife_building_algorithm
{
    public class Element
    {
        private int id;
        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        //private int node1id;
        //private int node2id;
 
        public Node node1;
        public Node node2;

        private double density;
        public double Density
        {
            get { return density; }
            set { density = value; }
        }

        private double area;
        public double Area
        {
            get { return area; }
            set { area = value; }
        }

        private Material material;
        public Material Material
        {
            get { return material; }
            set { material = value; }
        }


        private ElementForce elementforce;
        public ElementForce Elementforce 
        {
            get { return elementforce; }
            set { elementforce = value; }
        }


        public Element(int id,Node node1,Node node2,double density,double Area) {
            this.id = id;
            this.node1 = node1;
            this.node2 = node2;
            this.density = density;
            this.area = Area;
            this.material = null;
            this.elementforce = null;
        }

        

        public Node getNode1() {       return this.node1;       }
        public Node getNode2() {       return this.node2;       }

        //public void setMaterial(Material material) {
        //    this.material = material;
        //}

        public virtual double getLength(Node node1,Node node2)
        {
            double length = 0;
            double x1 = node1.Xcoord;
            double x2 = node2.Xcoord;
            double y1 = node1.Ycoord;
            double y2 = node2.Ycoord; 
            double z1 = node1.Zcoord;
            double z2 = node2.Zcoord;
            length = Math.Sqrt(Math.Pow((x1-x2),2)+Math.Pow((y1-y2),2)+Math.Pow((z1-z2),2));
            return length;
        }
    }
}
